<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

/**
 * 地址表验证器
 */
class AddressValidate extends Validate
{
    /**
     * 定义验证规则
     */
    protected $rule =   [
        'province' => 'require',
        'city' => 'require',
        'district' => 'require',
        'detailed_address' => 'require',
        'recipient_phone' => 'require',
        'recipient_name' => 'require',
        'customer_id' => 'require',
    ];

    /**
     * 定义错误信息
     */
    protected $message  =   [
        'province' => '省份必须填写',
        'city' => '城市必须填写',
        'district' => '区县必须填写',
        'detailed_address' => '详细地址必须填写',
        'recipient_phone' => '收件人电话必须填写',
        'recipient_name' => '收件人姓名必须填写',
        'customer_id' => '客户ID必须填写',
    ];

    /**
     * 定义场景
     */
    protected $scene = [
        'save' => [
            'province',
            'city',
            'district',
            'detailed_address',
            'recipient_phone',
            'recipient_name',
            'customer_id',
        ],
        'update' => [
            'province',
            'city',
            'district',
            'detailed_address',
            'recipient_phone',
            'recipient_name',
            'customer_id',
        ],
    ];

}
